package com.socket.server.controller;


import com.socket.server.config.OperationException;
import com.socket.server.config.ResultEnum;
import com.socket.server.service.OperationService;
import com.socket.server.utils.NettyServerHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ProjectName: springboot_socket
 * @Package: com.sn.socket.controller
 * @ClassName: ${CLASS_NAME}
 * @Author: xiahuihui
 * @Description: ${description}
 * @Date: 2020/5/12 0012 9:53
 * @Version: 1.0
 */
@CrossOrigin
@RestController
@RequestMapping("opera")
public class OperationController {



    @Resource
    private OperationService operationService;

    @PostMapping("device")
    public ResultEnum timelyDevice(@RequestBody Operat operat){
        try {
            operationService.timelyTask(operat);
        } catch (OperationException e) {
            e.printStackTrace();
            return ResultEnum.RESULT_NOT_FOUND_DEVICE_ERROR;
        }
        return ResultEnum.RESULT_SUCCESS;
    }
}
